package com.asl.website.cooperationDetailImg.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.asl.website.cooperationDetailImg.domain.CooperationDetailImgListVO;
import com.asl.website.core.JsonResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.asl.common.annotation.Log;
import com.asl.common.core.controller.BaseController;
import com.asl.common.core.domain.AjaxResult;
import com.asl.common.enums.BusinessType;
import com.asl.website.cooperationDetailImg.domain.CooperationDetailImg;
import com.asl.website.cooperationDetailImg.service.ICooperationDetailImgService;
import com.asl.common.utils.poi.ExcelUtil;
import com.asl.common.core.page.TableDataInfo;

/**
 * 合作网络图片Controller
 * 
 * @author ruoyi
 * @date 2025-05-21
 */
@RestController
@RequestMapping("/cooperationDetailImg/cooperationDetailImg")
public class CooperationDetailImgController extends BaseController
{
    @Autowired
    private ICooperationDetailImgService cooperationDetailImgService;

    /**
     * 查询合作网络图片列表-列表
     */
    @GetMapping("/listCooperation")
    public JsonResult listCooperationImg()
    {
        List<CooperationDetailImgListVO> list = cooperationDetailImgService.listCooperationImg();
        return JsonResult.ok(list);
    }

    /**
     * 查询合作网络图片列表
     */
    @PreAuthorize("@ss.hasPermi('cooperationDetailImg:cooperationDetailImg:list')")
    @GetMapping("/list")
    public TableDataInfo list(CooperationDetailImg cooperationDetailImg)
    {
        startPage();
        List<CooperationDetailImg> list = cooperationDetailImgService.selectCooperationDetailImgList(cooperationDetailImg);
        return getDataTable(list);
    }

    /**
     * 导出合作网络图片列表
     */
    @PreAuthorize("@ss.hasPermi('cooperationDetailImg:cooperationDetailImg:export')")
    @Log(title = "合作网络图片", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CooperationDetailImg cooperationDetailImg)
    {
        List<CooperationDetailImg> list = cooperationDetailImgService.selectCooperationDetailImgList(cooperationDetailImg);
        ExcelUtil<CooperationDetailImg> util = new ExcelUtil<CooperationDetailImg>(CooperationDetailImg.class);
        util.exportExcel(response, list, "合作网络图片数据");
    }

    /**
     * 获取合作网络图片详细信息
     */
    @PreAuthorize("@ss.hasPermi('cooperationDetailImg:cooperationDetailImg:query')")
    @GetMapping(value = "/{imgId}")
    public AjaxResult getInfo(@PathVariable("imgId") Long imgId)
    {
        return success(cooperationDetailImgService.selectCooperationDetailImgByImgId(imgId));
    }

    /**
     * 新增合作网络图片
     */
    @PreAuthorize("@ss.hasPermi('cooperationDetailImg:cooperationDetailImg:add')")
    @Log(title = "合作网络图片", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CooperationDetailImg cooperationDetailImg)
    {
        return toAjax(cooperationDetailImgService.insertCooperationDetailImg(cooperationDetailImg));
    }

    /**
     * 修改合作网络图片
     */
    @PreAuthorize("@ss.hasPermi('cooperationDetailImg:cooperationDetailImg:edit')")
    @Log(title = "合作网络图片", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CooperationDetailImg cooperationDetailImg)
    {
        return toAjax(cooperationDetailImgService.updateCooperationDetailImg(cooperationDetailImg));
    }

    /**
     * 删除合作网络图片
     */
    @PreAuthorize("@ss.hasPermi('cooperationDetailImg:cooperationDetailImg:remove')")
    @Log(title = "合作网络图片", businessType = BusinessType.DELETE)
	@DeleteMapping("/{imgIds}")
    public AjaxResult remove(@PathVariable Long[] imgIds)
    {
        return toAjax(cooperationDetailImgService.deleteCooperationDetailImgByImgIds(imgIds));
    }
}
